from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https:www.baidu.com')
# xpath定位标签和属性
kw = driver.find_element(By.XPATH, '//input[@id="kw"]')
print(kw.get_attribute('outerHTML'))

bt = driver.find_element(By.XPATH, '//input[@type="submit"]')
print(bt.get_attribute('outerHTML'))

driver.quit()
